package com.xs.designpattern;

/**
 * 静态内部类
 * @author xs
 */
public class InitializingOnDemandHolderIdiom {
    /**
     * 私有构造器
     */
    private InitializingOnDemandHolderIdiom() {
    }

    /**
     * 单例实例
     *
     * @return Singleton instance
     */
    public static InitializingOnDemandHolderIdiom getInstance() {
        return HelperHolder.INSTANCE;
    }

    /**
     * 提供延迟加载的 Singleton 实例
     */
    private static class HelperHolder {
        private static final InitializingOnDemandHolderIdiom INSTANCE = new InitializingOnDemandHolderIdiom();
    }
}
